<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8"/>
		<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
		<link rel="icon" href="./icons/icon-vector-large.svg"/>
		<meta name="robots" content="noindex"/>

		<title>Error - Joplin</title>
		<script src="./serviceWorker.bundle.js"></script>
		<link rel="stylesheet" href="./info-page.css"/>
	</head>
	<body>
		<main>
			<h1>⚠️ Error: Only one copy of Joplin can be open at a time ⚠️</h1>
			<p>
				At present, the Joplin web client only supports one open copy at a time in the same browser. This restriction is present to keep your data safe.
			</p>
			<p>
				To use Joplin in this tab, please <button id="close-all-other-web-clients">close all other Joplin web client tabs</button>,
				then <button id="refresh-this-page">refresh</button> this page.
			</p>
		</main>
	</body>
	<script>
		for (const refreshLink of document.querySelectorAll('#refresh-this-page')) {
			refreshLink.onclick = () => location.reload();
		}

		for (const closeLink of document.querySelectorAll('#close-all-other-web-clients')) {
			if (navigator.serviceWorker) {
				closeLink.onclick = () => {
					window.navigator.serviceWorker.controller.postMessage({ type: 'closeAllJoplinWebTabs' });
				};
			} else {
				closeLink.replaceWith(document.createTextNode(closeLink.textContent));
			}
		}
	</script>
</html>